package com.example.demo.jpa;

import com.example.demo.entity.UserEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;


/**
 * Created by ml on 2017-06-20.
 */
public interface UserJpa extends JpaRepository<UserEntity, Long> {

    @Query(value = "select * from t_user where t_age>?1", nativeQuery = true)
    public List<UserEntity> nativeQuery(int age);

    @Modifying
    @Query(value = "delete from t_user where t_name= ?1 and t_pwd= ?2", nativeQuery = true)
    public void deleteQuery(String name, String pwd);
}
